package main

import (
	"../deps/lessgo/service/lesskeeper"
	"../deps/lessgo/utils"
	"fmt"
)

func main() {

	client, _ := lesskeeper.NewClient(
		"http://127.0.0.1:1777/keeper/v1",
		"pub", "rp8jv2zcpbrhw4wf", "9aEKIF2RmFVT5IPKOD5uu1uUbyBB3yPW")

	rs := client.NodeGet("/pub/null")
	json, _ := utils.JsonEncode(rs)
	fmt.Println("GET /pub/null", json)

	rs = client.NodeSet(lesskeeper.Node{
		Key:   "/pub/msg",
		Value: "qiniu/bytes/blob/develop/seekable/seekable.go",
		Ttl:   60,
	})
	json, _ = utils.JsonEncode(rs)
	fmt.Println("SET /pub/msg", json)

	rs = client.NodeGet("/pub/msg")
	json, _ = utils.JsonEncode(rs)
	fmt.Println("GET /pub/msg", json)

	rs = client.NodeGet("/pub")
	json, _ = utils.JsonEncode(rs)
	fmt.Println("GET /pub", json)

	rs = client.NodeDel("/pub/msg")
	json, _ = utils.JsonEncode(rs)
	fmt.Println("DEL /pub/msg", json)

	rs = client.NodeGet("/pub/msg")
	json, _ = utils.JsonEncode(rs)
	fmt.Println("GET /pub/msg", json)
}
